package com.ruoyi.lhky.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.lhky.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("SELECT u.*, h.name AS workplaceName FROM user u LEFT JOIN hospital h ON u.workplace_id = h.id WHERE u.id = #{id}")
    User getUserWithWorkplace(Long id);

    @Select("SELECT * FROM user WHERE account = #{account}")
    User selectByAccount(String account);
}
